<?php

//活动管理
global $_GPC,$_W;
$et = $_GPC['et'];

//跳转到增加界面
if ($_GPC['et'] == 2) {

    $incooker = pdo_getall('szxh_nmyx_activeexpirty_kefuguanli');
    $sortname = pdo_getall('szxh_nmyx_activeexpirty_actionsort');
    //var_dump($sortname);
    //var_dump($incooker);
    include $this->template('adaction');
    return;
}




//从增加界面获取数据
if($_GPC['et'] == 3) {
    //$addate = $_POST;
    //var_dump($addate);
    //$incookername
    /*$arr = array('title' => $addate['title'],
                'image' => $addate['image'],
                'des' => $addate['ueditor'],
                'time' => $addate['date'],
                'ltitle' => $addate['titname'],
                'music' => $addate['audio'],
                'price' => $addate['price'],
                'incooker' => $addate['lncooker'],
                'imag' => $addate['imag'],
                'sort' => $addate['selectname']
            );
    $res = pdo_insert('szxh_activeexpirty_actionchange',$arr);

    $sumdate = pdo_getall('szxh_activeexpirty_actionchange');*/

    //var_dump($sumdate);

    $table = new HuodongguanliTable();
    $res = $table->insertDate($_POST);

    $sumdate = $table->getdate($_GET['page']);
    $sortpage = $table->pagesort(); 
    include $this->template('actionindex');
    return;
}


//删除选中的数据
if($_GPC['et'] == 4) {

    //$dedate = $_POST;
    //var_dump(11);
    //var_dump($dedate);
    /*foreach ($dedate as $value) {
        $delat = pdo_delete('szxh_activeexpirty_actionchange',array('id' => $value));
    }*/
    //$sumdate = pdo_getall('szxh_activeexpirty_actionchange');
    //var_dump($sumdate);
    $table = new HuodongguanliTable();
    $delat = $table->delDate($_POST);
    $sumdate = $table->getdate($_GET['page']);
    $sortpage = $table->pagesort(); 
    include $this->template('actionindex');
    return;
}


//在修改界面显示数据
if($_GPC['et'] == 5) {

    $id = $_GPC['uid'];
    var_dump($id);
    $incooker = pdo_getall('szxh_nmyx_activeexpirty_kefuguanli');
    $sortname = pdo_getall('szxh_nmyx_activeexpirty_actionsort');

    $rowTable = new HuodongguanliTable();
    $row = $rowTable->getrow($id);
    //var_dump($row); 
    //$row = pdo_get('szxh_activeexpirty_actionchange',array('id' => $id));
    //var_dump($row);
    include $this->template('chaction');
    return;
}

//更新数据
if ($_GPC['et'] == 6) {
    //$chdate = $_POST;
    //var_dump($chdate);
    //$uid = $_GPC['uid'];

    $table = new HuodongguanliTable();
    $chdateone = $table->upDate($_POST,$_GPC['uid']);
    //var_dump($uid);
    //var_dump($chdate);
    /*$uparr = array('title' => $chdate['title'],
                'image' => $chdate['image'],
                'des' => $chdate['ueditor'],
                'time' => $chdate['date'],
                'ltitle' => $chdate['titname'],
                'music' => $chdate['audio'],
                'price' => $chdate['price'],
                'incooker' => $chdate['lncooker'],
                'imag' => $chdate['imag'],
                'sort' => $chdate['selectname'],
                'state' => $chdate['state']
            );
    $chdateone = pdo_update('szxh_activeexpirty_actionchange',$uparr,array('id'=>$uid));

    if($chdateone) {
        message('保存成功', aurl(), 'success');
    } else {
        message('保存失败', 'referer', 'error');
    }
*/


    // $sumdate = pdo_getall('szxh_activeexpirty_actionchange');
    //var_dump($sumdate);

    // $table = new HuodongguanliTable();
    // $sumdate = $table->getdate($_GET['page']);
    // $sortpage = $table->pagesort(); 

    // include $this->template('actionindex');
    return;
}

if($_GPC['et'] == 7) {
    $this->display('orderform');
}

// 二维码
if($et == 10) {
    output_qrcode(web2app_url('home', ['id'=>$item['id']]));
    return;
}


$table = model('Huodongguanli');
$sumdate = $table->getdate($_GET['page']);
$sortpage = $table->pagesort();

include $this->template('actionindex');

